# -*- coding: utf-8 -*-
from fastapi import APIRouter

from .exam_router import get_job_list, get_company_list
from .material_router import (
    # 资料类型字典
    create_material_type, get_material_type_by_id, get_all_material_types,
    update_material_type, delete_material_type,
    # 文件来源字典
    create_file_source, get_file_source_by_id, get_all_file_sources,
    update_file_source, delete_file_source,
    # 资料表
    upload_material, get_material_by_id, get_materials, get_materials_fuzzy_search,
    get_materials_by_ids, update_material, delete_material, download_material
)

router = APIRouter()

# 原有接口
router.get("/job/list", tags=["exams"], summary="工作类型列表")(get_job_list)
router.get("/company/list", tags=["exams"], summary="公司类型列表")(get_company_list)

# 资料类型字典接口
router.post("/material/type", tags=["Material"], summary="创建资料类型")(create_material_type)
router.get("/material/type/{type_id}", tags=["Material"], summary="根据ID获取资料类型")(get_material_type_by_id)
router.get("/material/type", tags=["Material"], summary="获取所有资料类型")(get_all_material_types)
router.put("/material/type/{type_id}", tags=["Material"], summary="更新资料类型")(update_material_type)
router.delete("/material/type/{type_id}", tags=["Material"], summary="删除资料类型")(delete_material_type)

# 文件来源字典接口
router.post("/material/source", tags=["Material"], summary="创建文件来源")(create_file_source)
router.get("/material/source/{source_id}", tags=["Material"], summary="根据ID获取文件来源")(get_file_source_by_id)
router.get("/material/source", tags=["Material"], summary="获取所有文件来源")(get_all_file_sources)
router.put("/material/source/{source_id}", tags=["Material"], summary="更新文件来源")(update_file_source)
router.delete("/material/source/{source_id}", tags=["Material"], summary="删除文件来源")(delete_file_source)

# 资料表接口
router.post("/material/upload", tags=["Material"], summary="上传资料文件")(upload_material)
router.get("/material/{material_id}", tags=["Material"], summary="根据ID获取资料")(get_material_by_id)
router.post("/material/list", tags=["Material"], summary="分页获取资料列表")(get_materials)
router.post("/material/search", tags=["Material"], summary="模糊查询资料列表")(get_materials_fuzzy_search)
router.post("/material/batch", tags=["Material"], summary="批量获取资料列表")(get_materials_by_ids)
router.put("/material/{material_id}", tags=["Material"], summary="更新资料")(update_material)
router.delete("/material/{material_id}", tags=["Material"], summary="删除资料")(delete_material)
router.get("/material/{material_id}/download", tags=["Material"], summary="下载资料文件")(download_material)
